<?php
/**
 * <https://y.st./>
 * Copyright © 2018 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Lines',
	'<{subtitle}>' => 'Written in <span title="College Algebra">MATH 1201</span> by <a href="https://y.st./">Alex Yst</a>, finalised on 2018-02-14',
	'<{copyright year}>' => '2018',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<section id="problem0">
	<h2>Problem 0</h2>
	<p>
		The easiest way to find the equation of a line that passes through these two points is assume the line is straight, and first fine the slope.
		To do that, we subtract (1, 2) from (3, -1).
		This gives us (2, -3), meaning that we have a slope of -3/2 (y over x), or to put it more understandably, -1½.
	</p>
	<p>
		Now that we have the slope, we can find the y-intercept.
		We take one of the points, multiply its distance from the y axis (in other words, its x value) by the slope, and subtract that from it y value.
		Multiplying by one is exceptionally easy, so let&apos;s use the point (1, 2) for this.
		That gives us this equation: 2 - 1 * -1½ = 3½.
		Remember that subtracting a negative number results in a higher number, not a lower one.
	</p>
	<p>
		We have our slope and we have our y-intercept, so lets put them in function form: <strong>f(x) = -1½x + 3½</strong>
	</p>
</section>
<section id="problem1">
	<h2>Problem 1</h2>
	<p>
		There&apos;s a much easier technique for <a href="https://virtualnerd.com/algebra-1/quadratic-equations-functions/graphing/graph-basics/vertex-example">finding the vertex of a parabola</a> than what the book taught us, but let&apos;s use the book&apos;s method (transformations) for now.
		First, we need to reformat the equation a bit.
		Let&apos;s assume that g(x) is the most basic parabola, defined as x<sup>2</sup>.
		First, we can factor the original equation.
		We can use the standard $a[FOIL] logic and algebra to figure out how to rewrite this.
		To start with, we need to solve for a and b in our factoring:
	</p>
	<p>
		f(x) = x<sup>2</sup> - 6x + 3 = <strong>(x + a)<sup>2</sup> + b</strong>
	</p>
	<p>
		Using basic $a[FOIL] logic, we know that a will be half the multiplier of x.
		That is, since we have -6x, a has to equal -3.
		With a solved for, we can solve for b.
	</p>
	<p>
		f(x) = x<sup>2</sup> - 6x + 3 = <strong>(x - 3)<sup>2</sup> + b</strong>
	</p>
	<p>
		-3<sup>2</sup> is equal to 9, so to get our number from our original f(x) equation, 3, we need to subtract 6.
		B is therefore -6.
	</p>
	<p>
		f(x) = x<sup>2</sup> - 6x + 3 = <strong>(x - 3)<sup>2</sup> - 6</strong>
	</p>
	<p>
		f(g) is simply the squaring function, so we can replace our squaring process with it, resulting in the equation we need in order to apply a transformation:
	</p>
	<p>
		f(x) = x<sup>2</sup> - 6x + 3 = <strong>g(x - 3) - 6</strong>
	</p>
	<p>
		We can now see that we need to shift the vertex to the left -3 spaces (meaning to the right 3 spaces) and upward -6 spaces (meaning downward 6 spaces).
		A left shift is actually a subtraction, not an addition, so we need to subtract x=-3 from our base point, (0, 0), while adding y=-6 to that same point.
		That gives us the vertex point, which is (3, -6).
		To double-check this, we can first try making sure this point satisfies the original equation, then check x±1 from the vertex to show that our found vertex is indeed a local minimum.
	</p>
	<p>
		3<sup>2</sup> - 6 * 3 + 3 ≟ -6<br/>
		9 - 18 + 3 ≟ -6<br/>
		-6 = -6
	</p>
	<p>
		Here, we see our found vertex does indeed lie on our line.
		Next, we try 3±1.
	</p>
	<p>
		2<sup>2</sup> - 6 * 2 + 3 &gt; -6<br/>
		4 - 12 + 3 &gt; -6<br/>
		-5 &gt; -6
	</p>
	<p>
		4<sup>2</sup> - 6 * 4 + 3 &gt; -6<br/>
		16 - 24 + 3 &gt; -6<br/>
		-5 &gt; -6
	</p>
	<p>
		Everything checks out, so <strong>the vertex is (3, -6)</strong>.
	</p>
</section>
<section id="problem2">
	<h2>Problem 2</h2>
	<p>
		This problem is a bit strange.
		We&apos;re asked to come up with a piecewise function that, if graphed, would result in a smiling face being drawn.
		We&apos;re allowed to use straight lines, points, and parabolas.
		I prefer to draw sliles with vertical lines as the eyes.
		The problem is that vertical lines aren&apos;t allowed in functions, but horizontal lines used for eyes makes the face look like that of a stoner.
		To fix that, we&apos;ll have to use <strong>*almost*</strong> vertical lines, so the eye perceives them as mostly vertical without them being impossible to put in a function.
		We can do this by giving them a small domain and a huge slope.
	</p>
	<div style="display: table;">
		<p style="display: table-row;">
			<span style="display: table-cell; vertical-align: middle;">
				f(x) =
			</span>
			<span style="display: table-cell; font-size: 5em; vertical-align: middle;">
				{
			</span>
			<span style="display: table-cell; vertical-align: middle;">
				100x + 102, if -1.01 ≤ x ≤ -1<br/>
				x<sup>2</sup> - 2, if -1 &lt; x &lt; 1<br/>
				100x - 99, if 1 ≤ x ≤ 1.01<br/>
			</span>
		</p>
	</div>
	<p>
		Graphing this, we get an image similar to the following:
	</p>
	<img src="/img/CC_BY-SA_4.0/y.st./coursework/MATH1201/smile_graph.png" alt="smile graph" width="151" height="151" class="framed-centred-image"/>
</section>
END
);
